package mapper;


import org.apache.ibatis.annotations.*;
import pojo.User;

import java.util.List;

public interface UserMapper {

    @Select("select * from mybatis.user ")
    List<User> getUsers();

    //方法存在多个参数，所有的参数前面必须加上@Param("id")注解
    @Select("select  * from mybatis.user where id = #{uid}")
    int getUserById(@Param("uid") int id);

    @Insert("insert into mybatis.user (id, name, pwd) values (#{id}, #{name}, #{pwd})")
    void addUser(User user);

    @Update("update mybatis.user set name =#{name},pwd=#{pwd} where id = #{id}")
    void updateUser(User user);

    @Delete("delete from mybatis.user where id = #{id}")
    void deleteUser(int id);
}